<template>
  <div class="detailContent">
    <header id="header">
      <i class="iconfont icon-right" @click="goBack"></i>
      <h1>影片详情</h1>
    </header>
    <div id="content" class="contentDetail">
      <div class="detail_list">
        <div class="detail_list_bg"></div>
        <div class="detail_list_filter"></div>
        <div class="detail_list_content">
          <div class="detail_list_img">
            <img :src="movieInfo.albumImg" alt />
          </div>
          <div class="detail_list_info">
            <h2>{{movieInfo.nm}}</h2>
            <p>{{movieInfo.enm}}</p>
            <p>{{movieInfo.sc}}</p>
            <p>{{movieInfo.cat}}</p>
            <p>{{movieInfo.star}}</p>
            <p>{{movieInfo.src}} / {{movieInfo.dur}}分钟</p>
            <p>{{movieInfo.pubDesc}}</p>
          </div>
        </div>
      </div>
      <div class="detail_intro">
        <p class='mDesc'>电影简介:</p>
        <p>{{movieInfo.dra}}</p>
      </div>
       
      <div class="detail_player swiper-container">
        
             <p class="mPic">电影剧照:</p>
        <ul class="swiper-wrapper">
          <li class="swiper-slide"  v-for="(item, index) in movieInfo.photos" :key="index">
            <div>
              <img :src="item | formatImg(300.450)" />
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Detail',
  props: ['id'],
  data() {
    return {
      movieInfo: {}
    }
  },
  methods: {
    goBack() {
      this.$router.back()
    }
  },
  async activated() {
    let id = this.$route.params.id || this.$store.state.city.id
    let res = await this.$axios.get(`/api/detailmovie?movieId=${id}`)
    console.log(res)
    if (res.msg !== 'ok') return this.$toast('电影信息获取失败')
    this.movieInfo = res.data.detailMovie
    this.$nextTick(() => {
      new Swiper('.detail_player', {
        slidesPerView: 'auto',
        freeMode: true,
        freeModeSticky: true
      })
    })
  }
}
</script>

<style scoped>
.detailContent {
  position: relative;
  left: 0;
  top: -41px;
  bottom: 0;
  width: 100%;
  height: 100%;
  background-color: #fff;
  z-index: 2000;
}
#content.contentDetail {
  display: block;
  margin-bottom: 0;
}
#content .detail_list {
  height: 200px;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.detail_list .detail_list_bg {
  width: 100%;
  height: 100%;
  background: url(/miaomiao/images/movie_1.jpg) 0 40%;
  filter: blur(20px);
  background-size: cover;
  position: absolute;
  left: 0;
  top: 0;
}
.detail_list .detail_list_filter {
  width: 100%;
  height: 100%;
  position: absolute;
  background-color: #40454d;
  opacity: 0.55;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
}
.detail_list .detail_list_content {
  display: flex;
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
}
.detail_list .detail_list_img {
  width: 108px;
  height: 150px;
  border: solid 1px #f0f2f3;
  margin: 20px;
}
.detail_list .detail_list_img img {
  width: 100%;
  height: 100%;
}
.detail_list .detail_list_info {
  margin-top: 20px;
}
.detail_list .detail_list_info h2 {
  font-size: 20px;
  color: white;
  font-weight: normal;
  line-height: 40px;
}
.detail_list .detail_list_info p {
  color: white;
  line-height: 20px;
  font-size: 14px;
  color: #ccc;
}

#content .detail_intro {
  padding: 10px;
}
#content .detail_intro p {
 line-height: 22px;
}
#content .detail_player {
  margin: 20px;
  margin-left: 12px;
}
.detail_player .swiper-slide {
  width: 120px;
  margin-right: 20px;
  text-align: center;
  font-size: 14px;
  float: left;
}
.detail_player .swiper-slide img {
  width: 100%;
  margin-bottom: 5px;
}
.detail_player .swiper-slide p:nth-of-type(2) {
  color: #999;
}
.mDesc {
    color: #818181;
    font-size: 16px;
}
.mPic {
    color: #818181;
    font-size: 16px;
    margin-bottom: 15px;
}
</style>
